package EvaTCPL;

public class EvaTCPLround extends EvaTCPLaexpression
{
  int precision;
  double power;

  public EvaTCPLround(EvaTCPLaexpression e1, int e2)
    {
      super(e1);
      precision = e2;
      power = Math.pow(10,precision);
    }

  /** Evaluate this arithmetic expression. */
  public double evaluate()
    {
      return (Math.rint(sons[0].evaluate()*power))/power;
    }

  public String toString()
    {
      return "round("+sons[0].toString()+", "+precision+")";
    }

}
